/**
 * This class will test the Bazooka class and consequently the RechargeableWeapon class too
 */
package projet_v1.items.weapons;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import projet_v1.Breed;
import projet_v1.Vampire;
import projet_v1.items.ammo.Ammo;
import projet_v1.items.ammo.CategoryAmmo;

/**
 * 
 * @author Romain Roufast
 *
 */

public class TestBazooka {
	
	private Bazooka b;

	@Before
	public void setUp() throws Exception {
		b = new Bazooka();
	}

	@After
	public void tearDown() throws Exception {
		b = null;
	}

	/**
	 * Here we're testing the hit & useWeapon methods
	 */
	@Test
	public void testHit() {
		Vampire v = new Vampire(100);
		b.hit(v);
		assertEquals(false, b.isFull());
		assertEquals(50, b.getDamages(Breed.VAMPIRE));
	}
	

	@Test
	public void testReload() {
		Vampire v = new Vampire(100);
		b.hit(v);
		b.hit(v);
		assertEquals(false, b.isFull());
		b.reload(new Ammo(b.getCategoryAmmo()));
		assertEquals(true, b.isFull());
	}

	@Test
	public void testRemainsAmmunitions() {
		assertEquals(true, b.remainsAmmunitions());
	}

	@Test
	public void testGetCategoryAmmo() {
		assertEquals(CategoryAmmo.ROCKET, b.getCategoryAmmo());
	}

	@Test
	public void testIsFull() {
		assertEquals(true, b.isFull());
	}

	@Test
	public void testGetCategory() {
		assertEquals(CategoryWeapon.BAZOOKA, b.getCategory());
	}

	@Test
	public void testGetAccurancy() {
		assertEquals(0.8, b.getAccurancy(),0);
	}

	@Test
	public void testGetDamages() {
		assertEquals(3, b.getDamages().size());
	}

	@Test
	public void testGetDamagesBreed() {
		assertEquals(50, b.getDamages(Breed.VAMPIRE));
		assertEquals(60, b.getDamages(Breed.ZOMBIE));
		assertEquals(20, b.getDamages(Breed.MADZOMBIE));
	}

	@Test
	public void testHasAmmo() {
		assertEquals(true, b.hasAmmo());
	}

}
